package pdf;

import java.io.FileInputStream;
import java.io.IOException;

/**
 * @author huu
 * @create 2025-08-23-17:24
 * @Description: 实现InputBuffer中调用了多少次read 方法
 */
public class countReadInputBuffer extends InputBuffer{
    public countReadInputBuffer(FileInputStream fileInputStream) {
        super(fileInputStream);
    }
    private int count = 0;
    @Override
    public int read() throws IOException {
        count++;
        return super.read();
    }

    @Override
    public void close() throws IOException {
        System.out.println("调用了" + count + "次read方法");
        super.close();
    }

}
